<template>
  <el-popover placement="right" width="360" v-model="visible">
    <div class="container">
      <h3>新增套餐</h3>
      名称：
      <el-input size="small " type="text" v-model="newCourse.name" /> <br />
      几个月的套餐：
      <el-input size="small " type="text" v-model="newCourse.mouth" /> <br />
      原价：
      <el-input size="small " type="text" v-model="newCourse.normalPrice" />
      <br />
      打折价格：
      <el-input size="small " type="text" v-model="newCourse.salePrice" />
      <br />
      套餐是否推荐（1推荐0不推荐）：
      <el-input size="small " type="text" v-model="newCourse.type" /> <br />
      <el-button type="primary" @click="add">新增套餐</el-button>
    </div>
    <el-button slot="reference">新增套餐</el-button>
  </el-popover>

</template>

<script>
export default {
  data() {
    return {
      newCourse: {
      },
      visible: false

    };
  },
  computed: {
  },
  methods: {
    // 增加课程
    add() {
      this.$api.productApi.addMeal(this.newCourse).then(({ data }) => {
        console.log(data);
        this.$message.success(data.meta.msg);
        this.$emit('getAllMeal')
        this.visible = false
      });
    },
  },
  created() {

  },
};
</script>

<style scoped>
.img {
  margin-bottom: 10px;
}
.container {
  background-color: #fff;

  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  padding: 30px;
  display: flex;
  flex-direction: column;
}
</style>
